#! /usr/bin/python3
# coding:UTF-8
import random

words = ('python', 'jumble', 'easy', 'difficult',
         'answer', 'continue', 'phone', 'position', 'game')

print("""
        欢迎参加猜单词游戏
    把字母组合成一个正确的单词
""")
iscontinue = 'y'
while iscontinue.lower() == 'y':
    word = random.choice(words)
    correct = word

    jumble = ''
    while word:
        position = random.randrange(len(word))
        jumble += word[position]
        word = word[:position]+ word[(position+1):]
    print('乱序后的单词：',jumble)
    guess = input('\n请你猜：')
    while guess != correct:
        print('对不起，不正确！')
        guess = input('\n继续猜：')
    if guess == correct:
        print('猜对了，你真棒！')
    iscontinue = input('\n是否继续（Y/N）:')
